package org.design.utils.entity;

import lombok.Getter;
import lombok.Setter;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

/**
 * TreeData
 *
 * @author 樊温军
 * @date 2025/6/17 上午11:47
 */
@Setter
@Getter
public class TreeData implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;
    private String id;
    private String parentId;
    private String name;
    private List<TreeData> children;

    public TreeData() {
    }

    public TreeData(String id, String parentId, String name, List<TreeData> children) {
        this.id = id;
        this.parentId = parentId;
        this.name = name;
        this.children = children;
    }

    @Override
    public String toString() {
        // 返回json
        return "{\"id\":\"" + id + "\",\"parentId\":\"" + parentId + "\",\"name\":\"" + name + "\",\"children\":" + children + "}";
    }
}
